define(function (require, exports, module) {

	var util = require('util');
	require('bootstrap-validator');

	exports.run = function () {

		var ajaxForm = $('form');
		//表单验证
		ajaxForm.bootstrapValidator({
			feedbackIcons : {
				valid : 'glyphicon glyphicon-ok',
				invalid : 'glyphicon glyphicon-remove',
				validating : 'glyphicon glyphicon-refresh'
			},
			fields : {
				display_name : {
					validators : {
						notEmpty : {
							message : '请填写权限名称'
						},
						regexp : {
							regexp : /^[\w\u4E00-\u9FA5]{2,18}$/,
							message : '权限名称必须为2-18位中英文、数字及下划线'
						}
					}
				}
			}
		}).on('success.form.bv', function (e) {
			util.ajaxModalSubmit(ajaxForm);
		});
	};

});